package com.example.back.service.impl;

import com.example.back.model.Message;
import com.example.back.service.MessageService;
import com.example.back.mapper.MessageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* @author jialily
* @description 针对表【t_message】的数据库操作Service实现
* @createDate 2022-05-09 17:40:17
*/
@Service("messageService")
@Transactional(propagation = Propagation.SUPPORTS,rollbackFor = Exception.class)
public class MessageServiceImpl implements MessageService{

    @Autowired
    MessageMapper messageMapper;

    @Override
    public int insertMessage(String username, String message) {
        return this.messageMapper.insertMessage(username,message);
    }

    @Override
    public List<Message> selectAll() {
        return this.messageMapper.selectAll();
    }

    @Override
    public List<Message> selectUsername(String username) {
        return this.messageMapper.selectUsername(username);
    }
}
